Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Typings: lots of type definition fixes #695

Merged
merged 4 commits into from
Nov 3, 2020

Conversation

SimonWoolf
Copy link
Member

Fixes #694

Copy link
Member

@owenpearson owenpearson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, but should we also change the key property on CipherParams to the same union type?

@SimonWoolf
Copy link
Member Author

should we also change the key property on CipherParams to the same union type?

No, in an actual CipherParams instance (as you get by calling getDefaultParams) the key type is fixed, either a Buffer on node or a Wordarray in browsers. When creating a CipherParams (either using getDefaultParams or the short form cipher options) you can supply it as an arraybuffer, base64-encoded string etc. and it'll convert it as appropriate.

...Now I come to look for it, the typings are also missing Crypto.getDefaultParams. So that should probably be added too. And the typings for Crypto.generateRandomKey are wrong, it claims it'll return a string. Aaargh, I'll fix some of these. I should read through them start to finish at some point and see what other errors are in there..

@SimonWoolf
Copy link
Member Author

@owenpearson I went ahead and fixed a whole bunch of type issues I spotted while doing the initial change, so this is now a somewhat bigger pr, so new deeper review needed - thanks

@SimonWoolf SimonWoolf changed the title Typings: fix type def of ChannelOptions (everything is optional) Typings: lots of type definition fixes Nov 3, 2020
Previous ones didn't have error parameter as being optional, so wouldn't
give a type error if you checked a property on them unconditionally
@SimonWoolf SimonWoolf force-pushed the typings-channelparams-optional branch from a4a3083 to e07e9d1 Compare November 3, 2020 13:04
@SimonWoolf SimonWoolf merged commit df47cc0 into main Nov 3, 2020
@SimonWoolf SimonWoolf deleted the typings-channelparams-optional branch November 3, 2020 17:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

Rewind examples don't compile with Typescript
2 participants